package com.roocon.design_pattern.chapter04_future_design;

public class Client {

  public static void main(String[] args) throws InterruptedException {
    FutureService futureService = new FutureService();
    Future<String> future = futureService.submit(() -> {
      try {
        Thread.sleep(10_000);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
      return "FINISH";
    }, System.out::println);

    System.out.println("===============");
    System.out.println(" do other thing. ");
    Thread.sleep(1_000);
    System.out.println("===============");
    ////在future没有执行完的时候，堵塞
    //System.out.println(future.get());
  }
}
